{extend name="base/common"}

{block name="style"}
<link href="/static/summernote/summernote.css" rel="stylesheet">
<link href="/static/bootstrap-fileinput/css/fileinput.min.css" rel="stylesheet">
<link href="/static/js/jQuery-imgBox/imgbox.css" rel="stylesheet"/>
<style type="text/css">
    .note-editor.note-frame { border-radius: 0; border:0; margin-bottom: 0; }
    .front_cover_img {height: 200px; width: 300px; margin-top: 4px}
    .send_type_label {
        padding-left: 12px;
    }
</style>
{/block}

{block name="page-header"}

{/block}

{block name="main"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="mail-box-header">
            <div class="pull-right tooltip-demo">

                <a href="{:Url('index')}" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top"><i class="fa fa-times"></i> 关闭</a>
            </div>
                <h2>
                   附件上传
                </h2>
        </div>
        <div class="mail-box">
            <form class="form-horizontal" method="post">
                <div class="mail-body">
                    <div class="form-group"><label class="col-sm-2 control-label">标题:</label>
                        <div class="col-sm-10">
                            <input type="text"  name="title"  class="form-control">
                        </div>
                    </div>

                    <div class="form-group"><label class="col-sm-2 control-label">附件:</label>
                        <div class="col-sm-10">
                            <input id="input-file" type="file" class="file">
                        </div>
                    </div>



                    <div class="mail-body text-right tooltip-demo">

                        <button url="{:Url('add')}" class="btn btn-sm btn-primary ajax-post" target-form="form-horizontal"
                                data-toggle="tooltip" data-placement="top" >
                            <i class="fa fa-reply"></i> 添加
                        </button>
                        <a href="{:Url('index')}" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top"><i class="fa fa-times"></i> 关闭</a>
                    </div>
                    <div class="clearfix"></div>
                    <input type="hidden" name="path" value="">

                </div>
            </form>
        </div>
    </div>
</div>

{/block}

{block name="script"}
<script src="/static/summernote/summernote.min.js"></script>
<script src="/static/summernote/lang/summernote-zh-CN.js"></script>
<script src="/static/bootstrap-fileinput/js/fileinput.min.js"></script>
<script src="/static/bootstrap-fileinput/themes/fa/fa.js"></script>
<script src="/static/bootstrap-fileinput/js/locales/zh.js"></script>
<script src="/static/js/jQuery-imgBox/jquery.imgbox.js"></script>
<script src="/admin/js/plugins/iCheck/icheck.min.js"></script>
<script>
    $(document).ready(function () {
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });





    });

    $("#input-file").fileinput({
        showPreview: false,
        language: 'zh', //设置语言
        uploadUrl: '{:Url("Upload/picture")}', //上传的地址
        allowedFileExtensions: ['doc','xls','xlsx','docx','pdf'],
        maxFileSize: 1024 * 1024 * 2,
    }).on("filebatchselected", function(event, files) {
        $(this).fileinput("upload");
    }).on('fileuploaded', function(event, data, previewId, index) {
        var response = $.parseJSON(data.response);
        if(response.code == 1) {
            $("input[name='path']").val(response.data);
        } else {
            updateAlert(response.msg, 'warning');
        }
    });



//把content内容赋给隐藏表单

        $('.btn-primary').click(function(){
            $('.to_hiden').attr('value',$('.panel-body').text());
        })

    highlight_subnav("{:Url('Adjunct/index')}");


</script>
{/block}